package com.walle.concurrenttest.pattern.readwritelock;

/**
 * @author zhangjiapeng
 * @Package com.walle.concurrenttest.pattern.readwritelock
 * @Description: ${todo}
 * @date 2019/2/20 14:26
 */
public class ReadThread implements Runnable {

    private final Data data;

    public ReadThread(Data data) {
        this.data = data;
    }

    @Override
    public void run() {

        try {
            while (true){
                char[] chars =  data.read();
                System.out.println(Thread.currentThread().getName() + "reads" + String.valueOf(chars));
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
